<template>
<el-container class='headerStyle'>
  <el-header class="header" style="height:70px">
    <div style="float:left">
      <img src='' style="margin-top:6px"></img>
    </div>
    <div style="float:left;padding-left:10px">
      <span style="font-size:20px">网关后台管理系统</span>
    </div>
    <div class='close-btn'>
      <span style="font-size:14px" @click="submitLogOut()">退出</span>
    </div>
    <div style="float:right;padding-right:20px">             
      <span style="font-size:14px">{{userName}}</span>
    </div>
    <div style="float:right;padding-right:10px">
      <img src='../../../static/img/icon-user.png' style="margin-top:25px"></img>
    </div>
  </el-header>
</el-container>
</template>
<script>
  export default {
    mounted () {
      this.userName = sessionStorage.getItem('userName')
    },
    data () {
      return {
        userName: '',
        testForm: {
          pageNum: 1,
          recordNum: 2
        },
        personalCenterVisable: false,
        confirmPasswordVisable: false,
        changePasswordVisable: false,
        personalForm: {
          role: '',
          name: '',
          employeeTels: '',
          password: '',
          newPassword: '',
          confirmNewPassword: ''
        },
        rules: {
          password: [{
            required: true,
            message: '请输入密码',
            trigger: 'blur'
          }]
        },
        formLabelWidth: '25%'
      }
    },
    methods: {
      submitLogOut () {
        this.$confirm('确认退出登录么？', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          this.setLogOutFro()
        }).catch(() => {
          console.log('confirm退出登录失败')
        })
      },
      setLogOutFro () {
        console.log('setLogOut')
        sessionStorage.removeItem('isAdmin')
        sessionStorage.removeItem('userId')
        sessionStorage.removeItem('userName')
        this.$router.push('/login')
      }
    }
  }
</script>

<style scoped>
  .close-btn :hover{
    cursor: pointer;
  }
  .close-btn {
    float:right;padding-right:30px
  }
  .header {
    position: relative;
    box-sizing: border-box;
    width: 100%;
    height: 70px;
    font-size: 22px;
    line-height: 70px;
    color: #fff;
    background-color: #083B6F
  }

  .header .logo {
    float: left;
    width: 250px;
    text-align: center;
  }

  .user-info {
    float: right;
    padding-right: 50px;
    font-size: 16px;
  }

  .user-info .el-dropdown-link {
    position: relative;
    display: inline-block;
    padding-left: 50px;
    cursor: pointer;
    vertical-align: middle;
  }

  .user-info .user-logo {
  }

  .el-dropdown-menu__item {
    text-align: center;
  }

  .el-dialog .el-input {
    width: 80%
  }
</style>
<style>
  .sidebar {
    top:70px !important;
  }
  /* .headerStyle .header-title {
    height: 50px;
    font-size: 20px;
    color: #ffffff;
    margin-top:-10px;
    position: relative;
  } */
  .headerStyle .header-title {
    font-size: 20px;
    color: #ffffff;
    margin-top:-5px;
    width:auto;
  }
</style>
